package main

import (
	"fmt"
	"time"
)

func main() {
	now := time.Now()
	fmt.Println(now)
	fmt.Println(now.Second())
	fmt.Println(now.Year())
	december := time.December
	fmt.Println(int(december))
	fmt.Println(now.Month())
	fmt.Println(now.Second())
	//将获得的时间存储起来，方便使用
	result := fmt.Sprintf("%d-%d-%d  %d:%d:%d", now.Year(), int(now.Month()), now.Day(), now.Hour(), now.Month(), now.Second())
	fmt.Println(result)

	//时间格式化
	format := now.Format("Mon Jan 2 15:04:05 -0700 MST 2006")
	fmt.Println(format)
	//2006-01-02 15:04:05
	format2 := now.Format("2006-01-02 15:04:05")
	fmt.Println(format2)

}
